package com.dkd.day20250705;

import java.util.Scanner;

public class Main3 {

    //近些年来，我国防沙治沙取得显著成果。某沙漠新种植N棵胡杨（编号1-N），排成一排。
    //
    //一个月后，有M棵胡杨未能成活。
    //
    //现可补种胡杨K棵，请问如何补种（只能补种，不能新种），可以得到最多的连续胡杨树？
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = sc.nextInt();
        int [] deadTree = new int[sc.nextInt()];
        for (int i = 0; i < deadTree.length; i++) {
            deadTree[i] = sc.nextInt();
        }
        int bu = sc.nextInt();
       int res =  solve(count, deadTree, bu);
       System.out.println(res);

    }

    public static int solve(int count, int[] deadTree, int bu) {
        int maxLength = 0;

        //
        for (int i = 0; i < deadTree.length-bu+1; i++) {
            int right = deadTree[i+bu>deadTree.length-1?deadTree.length-1:i+bu];
            int left = deadTree[i-1<0?0:i-1];
            int length = right - left + 1;
            maxLength = Math.max(maxLength, length);
        }
        return maxLength;
    }
}
